package com.teleca.jamendo.api.impl;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;

import com.teleca.jamendo.mode.Album;

/**
 * @author Lukasz Wisniewski
 */
public class AlbumFunctions {

	public static List<Album> getAlbums(JSONArray jsonArrayAlbums) throws JSONException {
		int n = jsonArrayAlbums.length();
		ArrayList<Album> albumList = new ArrayList<Album>();
		AlbumBuilder albumBuilder = new AlbumBuilder();

		for (int i = 0; i < n; i++) {
			albumList.add(albumBuilder.build(jsonArrayAlbums.getJSONObject(i)));
		}
		return albumList;
	}
}
